/*
 * Alarms.cpp
 *
 *  Created on: Jan 21, 2014
 *      Author: ppks
 */

#include "Arduino.h"
#include "config.h"
#include "defines.h"
#include "Alarms.h"

/******************************************************************************/
/* Local Variables Declaration                                                */
/******************************************************************************/


/******************************************************************************/
/* Local Functions Declaration                                                */
/******************************************************************************/


/******************************************************************************/
/* Function Code                                                              */
/******************************************************************************/

/*******************************************************************************
* Function Name: Alarms_BlinkLED
********************************************************************************
* Summary:
*  Blinks the LEDPIN num times with the period ontime*2 and repeats it "repet"
*  number of times.
*  !!! Beware - this function is blocking and should not be used in flight.
*
* Parameters:
*  None
*
* Return:
*  None
*
*******************************************************************************/
void Alarms_BlinkLED(uint8_t num, uint8_t ontime,uint8_t repeat)
{
    uint8_t i;
    uint8_t r;

    for (r = 0; r < repeat; r++)
    {
        for(i = 0; i < num; i++)
        {
            /* switch LEDPIN state */
            LEDPIN_TOGGLE;
            delay(ontime);
        }

        /* wait 60 ms */
        delay(60);
    }
}
